<template>
  <div class="lottery-overlay">
    <div class="lottery-luckers lottery-popBox-ani" v-if="source == 'winPrize'">
      <div class="lottery-poptitle">{{ winprizeData.maxAwardTips }}</div>
      <div
        class="lottery-luckers-wrapper zam-app-flex-ajCenter2"
        :style="winprizeData.rollIdArr.length > 5 ? styleObject : ''"
      >
        <div
          class="lottery-luckers-item zam-app-flex-ajCenter"
          v-for="(win, index) in winprizeData.rollIdArr"
          :key="index"
        >
          <div
            class="frotate"
            :class="
              winprizeData.rollIdArr.length > 5
                ? 'win-luckers-item'
                : 'lottery-luckers-img'
            "
          >
            <img :src="win.avatar" :onerror="defaultImg" />
          </div>
          <div class="lottery-luckers-name zam-app-flex-ajCenter">
            <div>{{ win.name }}</div>
          </div>
        </div>
      </div>
      <div class="lottery-close-btn" @click="closePrize"></div>
    </div>

    <!-- 总中奖 -->
    <div class="win-luckers lottery-popBox-ani" v-if="source == 'prize'">
      <div class="win-luckers-wrapper">
        <div
          class="lottery-luckers-item zam-app-flex-ajCenter2"
          v-for="(lottery, key) in lotteryLuckers"
          :key="key"
        >
          <div class="luckers-item_l">{{ lottery.label }}:</div>
          <div class="luckers-item_r">
            <div
              class="luckers-item"
              v-for="(awad, index) in lottery.items"
              :key="index"
            >
              <div class="lottery-luckers-img frotate">
                <img :src="awad.avatar" :onerror="defaultImg" />
              </div>
              <div class="lottery-luckers-name zam-app-flex-ajCenter">
                <div>{{ awad.name }}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="lottery-close-btn" @click="closePrize"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "prizewinner",
  props: {
    lotteryLuckers: {
      type: Array,
      default: () => {},
    },
    winprizeData: {
      type: Object,
      default: () => {
        return {
          maxAwardTips: "",
          rollIdArr: "",
        };
      },
    },
    source: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      currLottery: false,
      defaultImg:
        'this.src="' +
        require("@/assets/images/activity/default_head.png") +
        '"',
      styleObject: {
        marginTop: "50px",
      },
    };
  },

  components: {},

  computed: {},

  mounted() {},

  methods: {
    closePrize() {
      this.$emit("closePrize", false);
    },
  },
};
</script>
<style lang='less' scoped>
.lottery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
}
/**中奖用户弹窗**/
.lottery-luckers {
  width: 60%;
  height: 90%;
  position: absolute;
  top: 20px;
  left: calc(50% - 600px);
  background: url("../../../assets/images/activity/win_luckers.png") no-repeat;
  background-size: 100% 100%;
  border-radius: 10px;
  transform: rotateX(180deg);
  z-index: 11;
}
.lottery-popBox-ani {
  display: block;
  animation: 1s linear 0s 1 normal forwards running lotterypopAni;
}
@keyframes lotterypopAni {
  from {
    opacity: 0;
    transform: rotateX(180deg);
  }
  to {
    opacity: 1;
    transform: rotateX(360deg);
  }
}
.lottery-luckers.hidden {
  display: none;
}
.lottery-luckers .lottery-poptitle {
  height: 40px;
  line-height: 40px;
  font-size: 48px;
  font-family: YRDZST-Medium, YRDZST;
  font-weight: 500;
  color: #ffffff;
  line-height: 51px;
  font-weight: 700;
  text-align: center;
  padding-top: 160px;
}
// 获奖
.lottery-luckers-wrapper {
  width: 100%;
  height: calc(100% - 300px);
  overflow-y: auto;
  flex-wrap: wrap;
  justify-content: center;
}
.lottery-luckers-item {
  width: 150px;
  margin: 10px 30px;
  .luckers-item_l {
    width: 120px;
    font-size: 28px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #ffffff;
    line-height: 40px;
  }
  .luckers-item_r {
    display: flex;
    // justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    .luckers-item {
      margin-right: 30px;
    }
    .lottery-luckers-img.frotate {
      position: relative;
      width: 98px;
      height: 98px;
      padding: 2px;
    }
  }
}
.win-luckers-item {
  position: relative;
  width: 90px;
  height: 90px;
  padding: 8px;
  border-radius: 50%;
}
.lottery-luckers-img.frotate {
  position: relative;
  width: 150px;
  height: 150px;
  padding: 8px;
  border-radius: 50%;
}
.win-luckers-item.frotate:after,
.lottery-luckers-img.frotate:after {
  content: "";
  display: block;
  position: absolute;
  top: -1px;
  /*no*/
  right: -1px;
  /*no*/
  bottom: -1px;
  /*no*/
  left: -1px;
  /*no*/
  border-top-right-radius: 50px;
  border-radius: 50%;
  background-image: linear-gradient(
    146deg,
    rgba(226, 247, 176, 0.5),
    rgba(236, 165, 48, 0.5)
  );
  z-index: -1;
}
.win-luckers-item img,
.lottery-luckers-img img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.lottery-luckers-name {
  height: 60px;
}
.lottery-luckers-name div {
  font-size: 20px;
  color: #fff;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lottery-close-btn {
  position: absolute;
  top: 110px;
  right: 10px;
  width: 112px;
  height: 46px;
  cursor: pointer;
  margin: 0 auto;
  margin-top: 10px;
  background-image: url("../../../assets/images/activity/close-dialog.png");
  background-repeat: no-repeat;
}
// 中奖名单
.win-luckers {
  width: 1360px;
  height: 870px;
  // position: absolute;
  // top: 70px;
  // left: calc(50% - 600px);
  background: url("../../../assets/images/activity/win-show.png") no-repeat;
  background-size: 100% 100%;
  border-radius: 10px;
  z-index: 111;
  margin: auto;
  .win-luckers-wrapper {
    position: absolute;
    left: 4%;
    top: 18%;
    width: 90%;
    height: 76%;
    overflow: auto;
    .lottery-luckers-item {
      width: auto;
      align-items: flex-start;
      &:nth-child(odd) {
        border-bottom: 1px dashed #f5a846;
        margin-bottom: 20px;
        padding-bottom: 20px;
      }
      &:nth-child(even) {
        border-bottom: 1px solid #f49e39;
        margin-bottom: 20px;
        padding-bottom: 20px;
      }
    }
    .lottery-luckers-name div {
      font-size: 24px;
    }
  }
}
</style>